while True:
    try:
        formula = input("请输入四则运算（例如：2+2），如需退出请按C：")
        if "+" in formula:
            formulaList = formula.split("+")
            result = int(formulaList[0]) + int(formulaList[1])
            print(result)
        elif "-" in formula:
            formulaList = formula.split("-")
            result = int(formulaList[0]) - int(formulaList[1])
            print(result)
        elif "*" in formula:
            formulaList = formula.split("*")
            result = int(formulaList[0]) * int(formulaList[1])
            print(result)
        elif "/" in formula:
            formulaList = formula.split("/")
            result = int(formulaList[0]) / int(formulaList[1])
            print(result)
        elif formula == "C":
            print("已退出，感谢使用")
            break
        else:
            raise Exception("请输入正确的四则运算格式或者按C退出")
    except ZeroDivisionError:  # 捕获的类型要在手动抛出的最基础Exception之前
        print("除数不能为0")
    except Exception as e:
        print(e)